Conventional cameras using an imaging element such as CCD are likely overexposed or underexposed, for example, during imaging in a backlighted condition because of their narrower dynamic range as compared with cameras using optical films. Overexposure causes a loss of grayscale in the bright area, while underexposure causes a loss of grayscale in the dark area. However, recent advances in solid-state imaging elements (lower noise) and bracket exposure synthesis technique have made it possible to obtain a RAW image signal having luminance grayscale with a wide dynamic range comparable to that of an optical film photograph.
On the other hand, the file formats (e.g., JPEG and MPEG) used to store captured moving and still images and common display devices such as CRTs, LCDs and printers even today have their limitations in luminance grayscale levels that can be expressed. That is, the images that can be expressed by a display device are narrow in dynamic range. Therefore, even if a RAW image signal of an image having luminance grayscale levels with a wide dynamic range comparable to that of an optical film photograph (hereinafter referred to as a wide dynamic range image) is obtained, it is impossible to store or express (e.g., display or print) the image. It should be noted that the RAW image signal is a so-called imager output signal.
As a result, a dynamic range compression technique is required which compresses the luminance grayscale levels of a wide dynamic range image into a narrower dynamic range so as to convert the wide dynamic range image into an image that can be expressed by display devices and other conventional equipment (hereinafter referred to as a narrow dynamic range image).
For example, a technique is available which determines the redistribution of grayscale levels in an adaptable manner based on the luminance histogram of a wide dynamic range image (refer to Patent Document 1). This technique transforms, for example, the grayscale levels of a wide dynamic range image into a histogram, thus redistributing the grayscale levels in accordance with those of a display device or other equipment having a narrower dynamic range and generating a narrow dynamic range image. Further, this technique determines a grayscale conversion curve by which the luminance values near the peak of the histogram are assigned to as many grayscale levels as possible, thus suppressing the decline in essential subject contrast. An approach designed to determine the output luminance in response to the input image luminance in an across-the-board manner as with this technique is called a global grayscale compression technique.
However, a global grayscale compression technique leads to a small luminance change at a luminance level at which the derivative of the grayscale conversion curve is small (luminance level at which the grayscale range is reduced), resulting in a poor-looking image devoid of small amplitude contrast and three-dimensional appearance of the subject (these will be hereinafter collectively referred to as a sense of texture or detail).
As a result, a local grayscale compression technique is available as a grayscale compression technique which solves the problem of poor appearance accompanied by a global grayscale compression technique. This technique narrows the dynamic range by compressing only the grayscale levels for the lighting component based on the knowledge that an image with a large dynamic range commonly occurs due to high contrast lighting rather than the contrast of the subject itself. This technique does not determine the output luminance in response to the input image luminance in an across-the-board manner, but instead the relationship between the input luminance and output luminance changes from one pixel to another. This is the reason why the technique is called a local grayscale compression technique, compared to a global grayscale compression technique.
Among techniques using a local grayscale compression technique is that adapted to compensate for the components other than the lighting component after temporarily performing grayscale compression of an image by means of a global grayscale compression technique (refer, for example, to Patent Document 2). In addition to the above, another technique is disclosed, for example, in document: Z. Rahman, D. J. Jobson and G. A. Woodell, “Multi-Scale Retinex for Color Image Enhancement”, Proc. of International Conference on Image Processing 1996, 1996, pp. 19P9.” This technique separates a wide dynamic range image into a plurality of frequency component images, subjects these images to amplitude modulations different from each other and adds up and combines the images into a single image.
These techniques divide an image into frequency bands using low-pass filters and treat the low-frequency image components as lighting components based on the characteristic that the common lighting distribution is gently sloping in areas other than the edges.    Patent Document 1: Japanese Patent Laid-Open No. Hei 9-331469    Patent Document 2: Japanese Patent Laid-Open No. 2004-221644